let vm = new Vue({
    el: "#login",
    methods: {
        login: function () {
            let data = new FormData(document.querySelector("#myform"));
            axios.post("/login", data).then(function (response) {
                if (response.data == 1) {
                    alert("登录成功");
                    location.href = "index.html";
                } else if (response.data == 2) {
                    alert("用户名不存在");
                } else if (response.data == 3) {
                    alert("密码错误");
                } else {
                    alert("未知错误");
                }
            })
        },
        reg: function () {
            let data = new FormData(document.querySelector("#myform"));
            data.delete("rem");
            axios.post("/reg", data).then(function (response) {
                if (response.data == 1) {
                    alert("注册成功");
                    location.reload();
                } else if (response.data == 2) {
                    alert("用户名已存在");
                } else if (response.data == 3) {
                    alert("用户名和密码不能为空");
                } else {
                    alert("注册失败");
                }
            })
        }
    }
})